import { makeAutoObservable } from 'mobx'
import { makePersistable } from 'mobx-persist-store';

class CollapsedStore {
  constructor() {
    makeAutoObservable(this)
    // mobx持久化，存储在sessionStorage中
    makePersistable(this, {
      name: 'CollapsedStore',
      properties: ['collapsed'],
      storage: window.sessionStorage
    })
  }
  collapsed = false
  setCollapsed = () => {
    this.collapsed = !this.collapsed
  }
}

export { CollapsedStore }